package com.tech.pattern.template.eg;

abstract class HummerModel {

    // 启动
    protected abstract void start();
    // 停止
    protected abstract void stop();
    // 鸣笛
    protected abstract void alarm();
    // 发出声响
    protected abstract void engineBoom();
    // 钩子方法，默认喇叭是会响的
    protected abstract boolean isAlarm();
    
    // 汽车运行过程
    void run() {
        this.start();
        this.engineBoom();
        if (isAlarm()) {
            this.alarm();
        }
        this.stop();
    }
}
